<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>05018197</title>
	<script src="http://shiva/~evansj/js/errorHandler.js" type="text/javascript" language="JavaScript" ></script>
</head>
<body>
<script type="text/javascript" language="javascript">
	loops(prompt("Please enter your max number here", 10));

	function loops(max) {
		var iteration = max;
		var intArray = new Array();

		document.write("<p>Printing iteration loop now.</p>");
		for (iteration; iteration>=0; iteration-=2) {
			document.write(((iteration != 6) ? iteration : "This value is " + iteration) + "<br />");
			intArray.push(iteration);
		}
		
		document.write("<p>Printing array now...using for...in</p>");
		for (var intgr in intArray) {
			document.write(intArray[intgr] + "<br />");
		}

		document.write("<p>Printing array now...using for...each</p>");
		for each (var intgr in intArray) {
			//document.write(intArray[intgr] + "<br />");
			document.write(intgr + "<br />");
		}

		document.write("<p>Printing array now...using another interesting way worth remembering</p>");
		function outputarray(element, index, array) {
			document.write("Element "+index+" contains the value "+element+"<br />");
		}
		intArray.forEach(outputarray); 

	}
</script>

<p>Printing Hyper links now.</p>
<a name="google" href="http://google.com" >Google</a><br />
<a name="yahoo" href="http://yahoo.com" >Yahoo</a><br />
<a name="msn" href="http://msn.com" >MSN</a><br />

<script type="text/javascript">

	for(var i = 0; i < document.anchors.length; i++)		// for each anchor on the page
	{
		var anchor = document.anchors[i];			// get the Nth anchor
		
		var url = anchor.href;					// get the anchor’s URL
		var name = anchor.name;					// get name=“” of the anchor
		var innerHTML = anchor.innerHTML;			// get the text the user sees
		
		document.write	(	"name = " + name +		// print this information on
					" url = " + url +		// the current web page
					" innerHTML " + innerHTML + 
					"<br />"
				);
	}
</script>

<p>Printing freebsd logo now.</p>
<a href="http://shiva/~evansj/"  onmouseover="alert('An onMouseOver event'); return false;">
<img src="http://www.freebsd.org/layout/images/beastie.png" />
</a>

</body>
</html>
